BEGIN;
-- CLEAN DATA
TRUNCATE TABLE ROLE;
TRUNCATE TABLE ROLE_FUNC_PERMISSION;

-- INIT DEFAULT ROLES
INSERT INTO ROLE(ID, TENANT_ID, NAME, STATUS, REMARK, CREATE_BY, CREATE_DATETIME, UPDATE_BY, UPDATE_DATETIME) VALUES(1, 0, 'GLOBAL_DEFAULT', 9, '系统预置全局角色，用户激活后即绑定该角色，获得该角色对应的权限，目前包含所有个人事务功能', 0, now(), 0, now());
INSERT INTO ROLE(ID, TENANT_ID, NAME, STATUS, REMARK, CREATE_BY, CREATE_DATETIME, UPDATE_BY, UPDATE_DATETIME) VALUES(2, 0, 'tenantLevel1', 9, '系统预置1级租户，开通1级租户的用户即绑定该角色，获得对应权限', 0, now(), 0, now());
INSERT INTO ROLE(ID, TENANT_ID, NAME, STATUS, REMARK, CREATE_BY, CREATE_DATETIME, UPDATE_BY, UPDATE_DATETIME) VALUES(3, 0, 'tenantLevel2', 9, '系统预置2级租户，开通2级租户的用户即绑定该角色，获得对应权限', 0, now(), 0, now());
INSERT INTO ROLE(ID, TENANT_ID, NAME, STATUS, REMARK, CREATE_BY, CREATE_DATETIME, UPDATE_BY, UPDATE_DATETIME) VALUES(4, 0, 'tenantLevel3', 9, '系统预置3级租户，开通3级租户的用户即绑定该角色，获得对应权限', 0, now(), 0, now());

-- INIT PERSONAL PERMISSION
INSERT INTO ROLE_FUNC_PERMISSION(TENANT_ID, ROLE_ID, PERMISSION_CODE) VALUES(0, 1, '03');
INSERT INTO ROLE_FUNC_PERMISSION(TENANT_ID, ROLE_ID, PERMISSION_CODE) VALUES(0, 1, '0301');
INSERT INTO ROLE_FUNC_PERMISSION(TENANT_ID, ROLE_ID, PERMISSION_CODE) VALUES(0, 1, '030101');
INSERT INTO ROLE_FUNC_PERMISSION(TENANT_ID, ROLE_ID, PERMISSION_CODE) VALUES(0, 1, '030102');
INSERT INTO ROLE_FUNC_PERMISSION(TENANT_ID, ROLE_ID, PERMISSION_CODE) VALUES(0, 1, '030103');
INSERT INTO ROLE_FUNC_PERMISSION(TENANT_ID, ROLE_ID, PERMISSION_CODE) VALUES(0, 1, '030104');
INSERT INTO ROLE_FUNC_PERMISSION(TENANT_ID, ROLE_ID, PERMISSION_CODE) VALUES(0, 1, '0302');
INSERT INTO ROLE_FUNC_PERMISSION(TENANT_ID, ROLE_ID, PERMISSION_CODE) VALUES(0, 1, '030201');
INSERT INTO ROLE_FUNC_PERMISSION(TENANT_ID, ROLE_ID, PERMISSION_CODE) VALUES(0, 1, '030202');
INSERT INTO ROLE_FUNC_PERMISSION(TENANT_ID, ROLE_ID, PERMISSION_CODE) VALUES(0, 1, '030203');
INSERT INTO ROLE_FUNC_PERMISSION(TENANT_ID, ROLE_ID, PERMISSION_CODE) VALUES(0, 1, '030204');
INSERT INTO ROLE_FUNC_PERMISSION(TENANT_ID, ROLE_ID, PERMISSION_CODE) VALUES(0, 1, '0303');
INSERT INTO ROLE_FUNC_PERMISSION(TENANT_ID, ROLE_ID, PERMISSION_CODE) VALUES(0, 1, '030301');
INSERT INTO ROLE_FUNC_PERMISSION(TENANT_ID, ROLE_ID, PERMISSION_CODE) VALUES(0, 1, '030302');
INSERT INTO ROLE_FUNC_PERMISSION(TENANT_ID, ROLE_ID, PERMISSION_CODE) VALUES(0, 1, '030303');
INSERT INTO ROLE_FUNC_PERMISSION(TENANT_ID, ROLE_ID, PERMISSION_CODE) VALUES(0, 1, '030304');
INSERT INTO ROLE_FUNC_PERMISSION(TENANT_ID, ROLE_ID, PERMISSION_CODE) VALUES(0, 1, '0304');
INSERT INTO ROLE_FUNC_PERMISSION(TENANT_ID, ROLE_ID, PERMISSION_CODE) VALUES(0, 1, '030401');
INSERT INTO ROLE_FUNC_PERMISSION(TENANT_ID, ROLE_ID, PERMISSION_CODE) VALUES(0, 1, '030402');
INSERT INTO ROLE_FUNC_PERMISSION(TENANT_ID, ROLE_ID, PERMISSION_CODE) VALUES(0, 1, '030403');
INSERT INTO ROLE_FUNC_PERMISSION(TENANT_ID, ROLE_ID, PERMISSION_CODE) VALUES(0, 1, '030404');
INSERT INTO ROLE_FUNC_PERMISSION(TENANT_ID, ROLE_ID, PERMISSION_CODE) VALUES(0, 1, '0305');
INSERT INTO ROLE_FUNC_PERMISSION(TENANT_ID, ROLE_ID, PERMISSION_CODE) VALUES(0, 1, '030501');
INSERT INTO ROLE_FUNC_PERMISSION(TENANT_ID, ROLE_ID, PERMISSION_CODE) VALUES(0, 1, '030502');
INSERT INTO ROLE_FUNC_PERMISSION(TENANT_ID, ROLE_ID, PERMISSION_CODE) VALUES(0, 1, '030503');
INSERT INTO ROLE_FUNC_PERMISSION(TENANT_ID, ROLE_ID, PERMISSION_CODE) VALUES(0, 1, '030504');

-- INIT MESSAGE CENTER PERMISSION
INSERT INTO ROLE_FUNC_PERMISSION(TENANT_ID, ROLE_ID, PERMISSION_CODE) VALUES(0, 1, '99');
INSERT INTO ROLE_FUNC_PERMISSION(TENANT_ID, ROLE_ID, PERMISSION_CODE) VALUES(0, 1, '9901');
INSERT INTO ROLE_FUNC_PERMISSION(TENANT_ID, ROLE_ID, PERMISSION_CODE) VALUES(0, 1, '990101');
INSERT INTO ROLE_FUNC_PERMISSION(TENANT_ID, ROLE_ID, PERMISSION_CODE) VALUES(0, 1, '990102');
INSERT INTO ROLE_FUNC_PERMISSION(TENANT_ID, ROLE_ID, PERMISSION_CODE) VALUES(0, 1, '990103');
INSERT INTO ROLE_FUNC_PERMISSION(TENANT_ID, ROLE_ID, PERMISSION_CODE) VALUES(0, 1, '990104');
INSERT INTO ROLE_FUNC_PERMISSION(TENANT_ID, ROLE_ID, PERMISSION_CODE) VALUES(0, 1, '9902');
INSERT INTO ROLE_FUNC_PERMISSION(TENANT_ID, ROLE_ID, PERMISSION_CODE) VALUES(0, 1, '990203');
INSERT INTO ROLE_FUNC_PERMISSION(TENANT_ID, ROLE_ID, PERMISSION_CODE) VALUES(0, 1, '990204');
COMMIT;